package com.isoft.farm.common;

import java.io.Serializable;
import java.util.List;

public class PageObject<T> implements Serializable {
    private static final long serialVersionUID = -2328343911597581150L;
    //页码
    private Integer pageCurrent;
    //数据条数
    private Integer pageSize;
    //数据总条数
    private Integer rowCount;
    //页面总页数
    private Integer pageCount;
    //每一页的数据
    private List<T> records;



    public PageObject(Integer pageCurrent, Integer pageSize, Integer rowCount, List<T> records) {
        this.pageCurrent = pageCurrent;
        this.pageSize = pageSize;
        this.rowCount = rowCount;
        this.records = records;
//        this.pageCount=rowCount/pageSize;
//        if(rowCount%pageSize!=0)
//            this.pageCount++;
        this.pageCount=(rowCount-1)/pageSize+1;

    }

    public PageObject() {

    }

    public Integer getPageCurrent() {
        return pageCurrent;
    }

    public void setPageCurrent(Integer pageCurrent) {
        this.pageCurrent = pageCurrent;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getRowCount() {
        return rowCount;
    }

    public void setRowCount(Integer rowCount) {
        this.rowCount = rowCount;
    }

    public Integer getPageCount() {
        return pageCount;
    }

    public void setPageCount(Integer pageCount) {
        this.pageCount = pageCount;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }

    @Override
    public String toString() {
        return "PageObject{" +
                "pageCurrent=" + pageCurrent +
                ", pageSize=" + pageSize +
                ", rowCount=" + rowCount +
                ", pageCount=" + pageCount +
                ", records=" + records +
                '}';
    }
}
